<link rel="stylesheet" type="text/css"
	href="<?php
	echo Yii::app ()->theme->baseUrl;
	?>/css/user.css" />

<script type="text/javascript">
$(document).ready(function() {	
	/*
	delete a user function
	*/
	
	$("#user-delete2").click(function(){
		
		 if (confirm("Are you sure you want to remove this user?")) 
			{
			 $.fancybox.close();}
	});
	$(".popupCancel").click(function(){
		
		 
			 $.fancybox.close();
	});
	// Add user Tab
	$('#addNewUser').click(function(){
		$('.addUserArea').hide();
		$('#newUserArea').show();
		$('#addExistUser').css('font-weight','normal');
		$('#addNewUser').css('font-weight','bold');
		return false;
		
		})
	$('#addExistUser').click(function(){
		$('.addUserArea').hide();
		$('#existingUserArea').show();
		$('#addNewUser').css('font-weight','normal');
		$('#addExistUser').css('font-weight','bold');
		return false;
		})
	//Edit User
	$(".user-text").click(function(){
			
			id = $(this).attr('id');
			//alert(id);
		 	pid=id.split('-')[0];
		 	uid=id.split('-')[1];
			$(location).attr('href',"<?php
			echo Yii::app ()->controller->createUrl ( "/people/userDetail" );?>?pid="+pid+"&uid="+uid);

			return false; 
	});	
	//Delete 1 User
			
	$("#remove-user").click(function(){	
		answer = confirm("Are you sure you want to delete this user?")	;
		
	})
			
	//Radio Click
			
		$("input:radio").click(function(){
			if($("input:radio:checked").val()=="select-all")
				$('input:checkbox').attr('checked',true);
			else $('input:checkbox').attr('checked',false);
		
				});
	//Edit Permission Click
		$('#edit-user').click(function(){
			// Checked user
			var listPeople = '';
			var count = 0;
			$('input:checkbox[name=select]:checked').each(function() {
				
				listPeople = listPeople + $(this).val();
				listPeople = listPeople +',';
				count++;
			})
			$("#selectedUser").val(listPeople);
			listPeople = '';	
			if(count==0)alert("Please select user by click checkbox!");
			})	
	//Delete User selected
			$('#remove-user').click(function(){
			// Checked user
			var listPeople = '';
			var count = 0;
			$('input:checkbox[name=select]:checked').each(function() {
				
				listPeople = listPeople + $(this).val();
				listPeople = listPeople +',';
				count++;
			})
			
			answer = confirm("Are you sure you want to delete user?");
	//Action			
			})
});
</script>

<div class="clear"></div>

<!--  Button Area -->
<div id="than"><img src="<?php
echo Html::imageUrl ( "muiten.png" );
?>"
	width="27" height="26" ; style="float: left">
<div id="textxanhdam">People</div>


</div>
<div class="padding15"></div>
<div id="leftSidebar">

<button type="button" class="user-add" href="#addUser" id="add-user"><img
	src="<?php
	echo Html::imageUrl ( "Add-Male-User.png" )?>" /> <br />
Add User!</button>


<button type="button" class="user-add" id="edit-user" href="#editUser"><img
	src="<?php
	echo Html::imageUrl ( "user_edit48.gif" )?>" /> <br />
Permission!</button>
<button type="button" class="user-add" id="remove-user"><img
	src="<?php
	echo Html::imageUrl ( "list-remove-user.png" )?>" /> <br />
Del User!</button>
</div>


<!--   List User Div-->
<div id="rightSidebar">

<div id="rightHeader">
<h2>Thành viên dự án
<h2>

</div>



<!--List User -->
<div style="margin-top: 25px">

<div id="user-select">
	<input type="radio" name="radio-select" value="select-all"><font style="font-size: 15px;color: #000">Select All User</font>
	<input type="radio" name="radio-select" value="unselect"><font style="font-size: 15px;color: #000">Unselect User</font>
</div>


<?php foreach($UserList as $item){?>
<div class="user-anh" id="<?php echo $pid."-".$item->user_id; ?>" href="#editUser"><a href=""> <img width="150" height="150" class = "user-avatar" 
	border="1px" src="<?php echo  $item->user_avatar ?>"> </a>
	<div class="user-text">
		<?php
		echo CHtml::link($item->user_name,'#' );
		?> 
        </div>
        <input name ="select" type="checkbox" value = "Value1"> </input>
	</div>
<?php }//end show user avatar?>

</div>

<!-- -None display Area -->

<div id="popup-edit" style="display: none">

<form id="user-edit-form" method="post" action="#">
<div class="popupHeader"><h2>Change Permission</h2></div>
<div class="popupUser" ><input type="radio"
	name="user-permission" value="admin" /><font style="color:#000;font-size:18px">Admin</font> <input type="radio"
	name="user-permission" value="member" /><font style="color:#000;font-size:18px">Member</font> </br>

	<div style="margin-top: 15px;margin-left:25px"><input type="submit" style="width: 70px;height: 30px;background-color: #D3DBF1"
	value="Save" /></div>
</div>

<div id="remove-user">
	<img src="<?php
	echo Html::imageUrl ( "list-remove-user.png" )?>" />
	Remove User
</div>
</form>
</div>

<!-- Edit Permission -->

<div id="popup-edit" style="display: none">

<form id="editUser" method="post" action="#">
<input id= "selectedUser" type = "text" value ="">
<div class="popupHeader"><h2>Change Permission</h2></div>
<div class="popupUser" ><input type="radio"
	name="user-permission" value="admin" /><font style="color:#000;font-size:18px">Admin</font> <input type="radio"
	name="user-permission" value="member" /><font style="color:#000;font-size:18px">Member</font> </br>

	<div style="margin-top: 15px;margin-left:25px"><input type="submit" style="width: 70px;height: 30px;background-color: #D3DBF1"
	value="Save" /></div>
</div>

<div id="remove-user">
	<img src="<?php
	echo Html::imageUrl ( "list-remove-user.png" )?>" />
	Remove User
</div>
</form>
</div>

<!-- Add user popup -->
<div id="addUserPopup" style="display: none;">
<div id="addUser" class="popupWrapper" action="" method="post">
<div class="popupHeader">
<h2>Add User</h2>

</div>
<div style="align-top: 10px; font-size: 15px;"><a href="#"
	id="addExistUser" style="color: black">Add Existing user |</a> <a
	href="#" id="addNewUser" style="color: black">Add new user </a></div>
<div class="popupContent">
<div id="existingUserArea" class="addUserArea">
<form method="post" action=""><!-- Add existing User -->


<div id="addUserCompany" style="display: inline-block">Search by Company

<select>
	<option value="0" selected>No Priority Selected</option>
	<option value="1">Low</option>
	<option value="2">Medium</ontion>
	
	
	<option value="3">High</option>
</select></div>
<div style="float: right">Search by Name <input type="text"
	class="addUserName" style="width: 40%"></input></div>

<div class="padding5"></div>



<div class="postButton"><input type="submit" value="Add " /> or <a
	href="#" class="popupCancel">Cancel</a></div>
</form>
</div>
<!-- Add non existing User -->
<div id="newUserArea" style="display: none" class="addUserArea">
<form method="post" action="">
<div id="addExistUserCompany">Company <select>
	<option value="0" selected>No Priority Selected</option>
	<option value="1">Low</option>
	<option value="2">Medium</ontion>
	
	
	<option value="3">High</option>
</select></div>

<div id="firstNameId" style="display: inline-block">
<p>First Name</p>
<input type="text" id="firstName" style="width: 100%"></input></div>
<div id="lastNameId" style="float: right; margin-right: 20%">
<p>Last Name


<p><input type="text" id="lastName" style="width: 100%"></input>

</div>

<div class="padding5"></div>

<div id="mailId">
<p>Email</p>
<input type="text" id="mail" style="width: 50%"></input></div>

<div style="display: inline-block">
<p>Choose password</p>
<input type="password" id="password" style="width: 100%"></input></div>
<div style="float: right; margin-right: 20%">
<p>Confirm Password


<p><input type="password" id="confirmPass" style="width: 100%"></input>

</div>
<div class="padding5"></div>
<div class="postButton"><input type="submit" value="Add this person" />
or <a href="#" class="popupCancel">Cancel</a> &nbsp&nbsp <input
	type="checkbox" name="sendMail" />Send Mail to this person</div>
</form>
</div>
<!-- End add  --></div>
</div>
</div>


<!-- Config Fancy Box  -->


<?php
$this->widget ( 'application.extensions.fancybox.EFancyBox', array ('target' => 'a.user-avatar', 'config' => array ('scrolling' => 'no', 'titleShow' => false, 'hideOnOverlayClick' => false ) ) );
?>
<?php

$this->widget ( 'application.extensions.fancybox.EFancyBox', array ('target' => 'button#add-user', 'config' => array ('scrolling' => 'no', 'titleShow' => false, 'hideOnOverlayClick' => false ) ) );
$this->widget ( 'application.extensions.fancybox.EFancyBox', array ('target' => 'button#edit-user', 'config' => array ('scrolling' => 'no', 'titleShow' => false, 'hideOnOverlayClick' => false ) ) );
?>